function fnlogining1() {
    var username = document.getElementById("ID").value;
    var password = document.getElementById("PASSWORD").value;
    if (username == "") {
        alert("用户名不能为空！", {header: '提醒'});
    } else if (password == "") {
        alert("密码不能为空！", {header: '提醒'});
    } else {
        AjaxFunc();
    }
}
function AjaxFunc() {
    var username = document.getElementById("ID").value;
    var password = document.getElementById("PASSWORD").value;
    let matchResult = true;
    if (username == "" || password == "") {
        alert("请确认用户名密码是否为空！");
        matchResult = false;
    } else if (username.length < 6 || username.length > 20) {
        alert("用户名长度应在6到20个字符之间！");
        matchResult = false;
    } else if (password.length < 6 || password.length > 20) {
        alert("密码长度应在6到20个字符之间！");
        matchResult = false;
    }
    if (matchResult == true) {
        function isIE() {
            if (!!window.ActiveXObject || "ActiveXObject" in window)
                return true;
            else
                return false;
        }

        if (isIE()) {
            var data1=JSON.stringify({
                "username":username,
                "password":password
            });
            $.ajax({
                type: 'POST',
                url: "/login",
                data: data1,
                success: function (res) {
                    if(res.allowLogin){
                        location.href = "/home";
                        return;
                    }
                    alert("用户名密码输入错误");
                }
            });
        } else {
            var data1=JSON.stringify({
                username:username,
                password:password
            });
            $.ajax({
                type: 'POST',
                url: "/login",
                data:data1,
                success: function (res) {
                    if(res.allowLogin){
                        location.href = "/home";
                        return;
                    }
                    alert("用户名密码输入错误");
                }
            });


            // (function(){
            //    var aa= `ServerAgent.invoke("login", {username, password}).then(res => {
            //         console.log(res);
            //         if(res.allowLogin){
            //             location.href = "/home";
            //             return;
            //         }
            //         alert("用户名密码输入错误");
            //     })`;
            // })()

        }

    }
}
//修改密码begin
function changepassword(){
    location.href ='/changepassword'
}
//修改密码end